package com.ximcontroller.models.elements;

import java.util.Collection;
import java.util.HashMap;

public final class XIM extends Element
{
	static final long serialVersionUID = 200911280034L;
	
	private boolean on;
	HashMap<Integer, XIMSystem> systems;
	
	public XIM()
	{
	}
	
	public XIM(int id, String name, String description)
	{
		super(id, name, description);
	}
	
	public void setOn(boolean on)
	{
		this.on = on;
		this.notifyObservers();
	}

	public boolean isOn()
	{
		return on;
	}

	public void addSystem(XIMSystem system)
	{
		this.systems.put(system.getID(), system);
		this.notifyObservers();
	}
	
	public void removeSystem(int id)
	{
		this.systems.remove(id);
		this.notifyObservers();
	}
	
	public XIMSystem getSystem(int id)
	{
		return this.systems.get(id);
	}
	
	public Collection<? extends XIMSystem> listSystems()
	{
		return this.systems.values();
	}
}
